<%@page import="java.util.ArrayList"%>
<%@page import="net.sf.jsr107cache.CacheException"%>
<%@page import="java.util.Collections"%>
<%@page import="net.sf.jsr107cache.CacheManager"%>
<%@page import="net.sf.jsr107cache.Cache"%>
<%@page import="domain.model.Domain"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@page import="java.util.List"%>
<%
Cache cache=null;

try {
    cache = CacheManager.getInstance().getCacheFactory().createCache(Collections.emptyMap());
} catch (CacheException e) {
   e.printStackTrace();
   
}

ArrayList<String[]> lastUpdateDomain = null;
if(cache!=null&&cache.containsKey("lastPings"))
{
	lastUpdateDomain = (ArrayList<String[]>)cache.get("lastPings");
}

	String title = (String) request.getAttribute("title");
	String description = (String) request.getAttribute("description");
%>
<?xml version="1.0" encoding="UTF-8"?>
  <rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/">
	
    <channel>
    
    <title><![CDATA[ <%=title %>]]></title>
    <link>http://www.find-domains.org/</link>
    <description><![CDATA[<%=description %>]]></description>
    <dc:language>en-ca</dc:language>
    <dc:creator>google app engine</dc:creator>

    <dc:rights>Copyright 2011</dc:rights>
    <admin:generatorAgent rdf:resource="http://www.find-domains.org/" />
    	<%
    	if(lastUpdateDomain != null)
    	{
	    	for(String[] domainName : lastUpdateDomain) 
			{
    	%>
		       <item>
		          <title><![CDATA[ <%=domainName[1]%> ]]></title>
		          <link>http://www.find-domains.org/domain/<%=domainName[0] %></link>
		          <guid>http://www.find-domains.org/domain/<%=domainName[0] %></guid>
		
		          <description><![CDATA[ 
		          <%
		          		if(domainName[2] != null)
		          		{
		          			out.println(domainName[2].replaceAll("\\<.*?\\>", ""));
		          		} else {
		          			out.println("");
		          		}     
		          %>
		          ]]></description>
		      	  <pubDate>
		      	  	<%=domainName[3]%>
		      	  </pubDate>
		       </item>
       <%
    		}
    	}
       %>
	        
	    
    </channel>
</rss>  